<? 
		if(isset($_POST['btnsubmit']))
		{
			require("required/dbconnect.php"); 
			
			$type_name=$_POST['type_name'];
			$flat_rate=$_POST['flat_rate'];
			$status=$_POST['status'];			
			$use_flat_rate=$_POST['use_flat_rate'];
			
			$insert=mysql_query("insert into os_shipping_type(type_name,flat_rate,use_flat_rate,status)value('$type_name','$flat_rate','$use_flat_rate','$status')")or die(mysql_error());
			header("Location:shipping_view_all.php?action=1");		
		}
		else
		{
				require("required/dbconnect.php"); 
				require("required/function.php"); 
				require("required/header.php"); 
				
				
?>
				
                <script language="javascript">
					function validateFrm(frm1){
						if(document.frm1.type_name.value=="")
						{
							alert("Please enter shipping company name");
							document.frm1.type_name.focus();
							return false;
						}
						if(document.frm1.flat_rate.value=="")
						{
							alert("Please enter flat rate");
							document.frm1.flat_rate.focus();
							return false;
						}
						
						return true;
							
					}
				</script>
				<table width="100%"  cellpadding="0" cellspacing="5" height="300">
					
					<td width="84%" align="left" valign="top">
					
						<form action="<?= $_SERVER['PHP_SELF'] ?>" name="frm1" method="post" onSubmit="return validateFrm(this)">
						<table width="100%">
						
						<td class="title" colspan="3">
						<strong>Add Shipping Company</strong>
						</td>
						<tr>
							<td>Company Name</td><td>:</td><td><input class="text" type="text" name="type_name" size="30" value="" maxlength="200"></td>
						</tr>
						<tr>
							<td>Use Flat Rate</td><td>:</td><td>
                            	<select name="use_flat_rate">
                                	<option value="1">Yes</option>
                                    <option value="2">No</option>
                            	</select>
                                
                            </td>
						</tr>
						<tr>
							<td>Flat Rate</td><td>:</td><td><input class="text" type="text" name="flat_rate" size="5" value="" maxlength="5"></td>
						</tr>
						<tr>
							<td>Publish</td>
                            <td>:</td>
							<td>
								<select name="status" class="text">
									<option value="0">No</option>
									<option value="1">Yes</option>
								</select>	
							</td>
						</tr>
						<tr>
							<td colspan="2"><input type="submit" value="Submit" name="btnsubmit"></td>
						</tr>
						</table>
						</form>
					</td>
				 
				</table>
<? }require("required/footer.php"); ?>